// Demo.cs
namespace CSharpPro
{
    public class Demo7Week
    {
        public static void Run()
        {
            // 测试抽象类
            UserTest userTest = new UserTestImpl();
            userTest.M1();
            userTest.M2();
            userTest.M3();

            // 测试接口
            UserService userService = new UserServiceImpl();
            userService.AddUser("张三");
            userService.QueryUser("张三");
            userService.UpdateUser("张三", "李四");
            userService.DeleteUser("李四");

            // 测试继承
            Father childObj = new Child();
            childObj.FatherMethod();
            if (childObj is Child child)
            {
                child.ChildMethod();
            }

            Father sonObj = new Son();
            sonObj.FatherMethod();
            if (sonObj is Son son)
            {
                son.SonMethod();
            }

            // 测试 Student 类
            Student stu = new Student { Name = "王五", Age = 20 };
            stu.Study();

            Console.WriteLine("按回车键退出...");
            Console.ReadLine();
        }
    }
}